var pageii = null;
var grid = null;
$(function() {

	grid = lyGrid({
		pagId : 'paging',
		l_column : [{
			colkey : "job_number",
			name : "工号"
		},{
			colkey : "dname",
			name : "部门",
			
		},{
			colkey : "pname",
			name : "姓名"
		},{
			colkey : "number",
			name : "餐数",
			
		},{
			colkey : "money",
			name : "扣除金额",
			
		}, {
			colkey :"remake",
			name : "备注",
		}],
		jsonUrl : rootPath + '/hrdiner/diner_findByPage.shtml',
		dymCol:true,
		checkbox : true,
		serNumber : false
	});
	$("#addOrder").click("click", function() {
		addAccount();
	});
	$("#editOrder").click("click", function() {
		editAccount();
	});
	$("#delFun").click("click", function() {
		delAccount();
	});
	$("#delFuns").click("click", function() {
		delAccounts();
	});
	$("#addOrders").click("click", function() {
		addAccounts();
	});
	$("#search").click("click", function() {// 绑定查询按扭
		
		var searchParams = $("#searchForm").serializeJson();
		grid.setOptions({
			data : searchParams
			
		});
	});
	
});





function editAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox.length > 1) {
		layer.msg("只能选中一个");
		return;
	}
	if(cbox == ""){
		layer.msg("需要选择一个");
		return;
	}
	pageii = layer.open({
		title : "编辑餐费信息 ",
		type : 2,
		area : [ "800px", "100%" ],
		content : rootPath + '/hrdiner/diner_edit.shtml?id=' + cbox
	});
}


